// 配置管理模块

//========== 公共变量定义 ==========
const API_URL_BASE = "http://192.168.31.107:8000";
const API_URL_RECOGNIZE = `${API_URL_BASE}/recognize-resources`;
const API_URL_UPLOAD = `${API_URL_BASE}/upload/`;
const API_URL_OCR = `${API_URL_BASE}/ocr/`;
//用户配置
const CONFIG = `${API_URL_BASE}/config/`;
 
// 截图路径
const SCREENSHOT_PATH = "/sdcard/screenshot.png";
// 剪裁后的图片路径
const CROPPED_PATH = "/sdcard/clip_screenshot.png";

// 获取API URL的函数
function getApiUrls() {
    return {
        baseUrl: API_URL_BASE,
        recognizeUrl: API_URL_RECOGNIZE,
        uploadUrl: API_URL_UPLOAD,
        ocrUrl: API_URL_OCR,
        configUrl: CONFIG,
        SCREENSHOT_PATH : SCREENSHOT_PATH,
        CROPPED_PATH : CROPPED_PATH
    };
}



// 用户手机型号配置
function getPhoneModelConfig(model) {
    // 红米 Turbo 自定义
    const PHONE_CONFIGS = {
        REDMIN_TURBO: {
        // 控制台窗口
        CONSOLE: { x: 1600, y: 380, width: 700, height: 500 },
        // 游戏结束按钮坐标
        GAME_END_BUTTON: {x: 1397, y: 1094},
        // 资源截图区域
        RESOURCES: { x: 106, y: 150, width: 350, height: 200 },
        // 游戏结束检测区域
        GAME_END: { x: 1335, y: 1069, width: 80, height: 60 },
        // 异常检测区域
        ABNORMAL: { x: 1355, y: 1066, width: 70, height: 60 },
        // 搜鱼起始点击点
        FISHING_START_1: {x: 2275, y: 92},
        FISHING_START_2: {x: 2371, y: 707},
        // 进攻
        FISHING_START_3: {x: 288, y: 1151},
        // 搜索
        FISHING_START_4: {x: 1911, y: 801},     
        // 回营位置

        RETURN_BASE: {x: 1203, y: 906},

        }

    };

        if (PHONE_CONFIGS[model]) {
        return PHONE_CONFIGS[model];
    } else {
        throw new Error('Unsupported phone model');
    }
}




// 导出函数
module.exports = {

    getApiUrls,
    getPhoneModelConfig
};